#include "StdAfx.h"
#include "SoftUpdateUI.h"



CSoftUpdateWnd::CSoftUpdateWnd( LPCTSTR pszxml )
{
	SetXml(pszxml);
}

void CSoftUpdateWnd::SetXml( LPCTSTR psXml )
{
	m_szXml = psXml;
}

LRESULT CSoftUpdateWnd::OnCreate( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{
	LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
	styleValue &= ~WS_CAPTION;
	styleValue &= ~WS_THICKFRAME;
	::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
	m_pm.Init(m_hWnd);
	CDialogBuilder builder;
	CControlUI* pRoot = builder.Create(m_szXml.GetData(), (UINT)0,NULL, &m_pm);
	ASSERT(pRoot && "Failed to parse XML");
	m_pm.AttachDialog(pRoot);
	m_pm.AddNotifier(this);
	return 1;
}

LPCTSTR CSoftUpdateWnd::GetWindowClassName() const
{
	return _T("SoftUpdate");
}

LRESULT CSoftUpdateWnd::HandleMessage( UINT uMsg, WPARAM wParam, LPARAM lParam )
{
	LRESULT lRes = 0;
	BOOL bHandled = TRUE;
	switch( uMsg ) 
	{
		case WM_CREATE:        lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
		default:
			bHandled = FALSE;
	}

	if( bHandled ) return lRes;
	if( m_pm.MessageHandler(uMsg, wParam, lParam, lRes) ) return lRes;
	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}



void CSoftUpdateWnd::Notify( TNotifyUI& msg )
{	
	if( msg.sType == _T("click") ) 
	{
	}
}



